<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>课程考试 - 护工助手</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/training.css">
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_3159099_1wqzwg0e9ck.css">
    <style>
        .exam-header {
            background-color: var(--bg-white);
            padding: var(--spacing-md);
            margin-bottom: var(--spacing-md);
        }
        
        .exam-title {
            font-size: 18px;
            font-weight: 600;
            margin: 0 0 var(--spacing-xs);
            color: var(--text-primary);
        }
        
        .exam-info {
            display: flex;
            flex-wrap: wrap;
            gap: var(--spacing-md);
            font-size: 14px;
            color: var(--text-secondary);
            margin-bottom: var(--spacing-md);
        }
        
        .exam-info-item {
            display: flex;
            align-items: center;
        }
        
        .exam-info-item i {
            margin-right: 4px;
            font-size: 16px;
        }
        
        .timer-container {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background-color: var(--primary-light);
            padding: var(--spacing-sm) var(--spacing-md);
            border-radius: var(--radius-md);
            color: var(--primary-color);
            font-weight: 500;
        }
        
        .timer-label {
            font-size: 14px;
        }
        
        .timer {
            font-size: 16px;
            font-weight: 600;
        }
        
        .timer.warning {
            color: var(--warning-color);
        }
        
        .timer.danger {
            color: var(--danger-color);
            animation: pulse 1s infinite;
        }
        
        .question-nav {
            display: flex;
            overflow-x: auto;
            background-color: var(--bg-white);
            padding: var(--spacing-sm) var(--spacing-md);
            margin-bottom: var(--spacing-md);
            -webkit-overflow-scrolling: touch;
        }
        
        .question-nav::-webkit-scrollbar {
            display: none;
        }
        
        .question-number {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 8px;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            font-size: 14px;
            flex-shrink: 0;
        }
        
        .question-number.active {
            background-color: var(--primary-color);
            color: white;
        }
        
        .question-number.answered {
            background-color: var(--success-color);
            color: white;
        }
        
        .question-container {
            background-color: var(--bg-white);
            padding: var(--spacing-md);
            margin-bottom: var(--spacing-md);
            border-radius: var(--radius-md);
        }
        
        .question-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: var(--spacing-md);
        }
        
        .question-type {
            background-color: var(--primary-light);
            color: var(--primary-color);
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 12px;
        }
        
        .question-points {
            font-size: 14px;
            color: var(--text-secondary);
        }
        
        .question-content {
            font-size: 16px;
            line-height: 1.6;
            color: var(--text-primary);
            margin-bottom: var(--spacing-md);
        }
        
        .options-list {
            display: flex;
            flex-direction: column;
            gap: var(--spacing-md);
        }
        
        .option-item {
            display: flex;
            padding: var(--spacing-md);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .option-item:hover {
            background-color: var(--bg-light);
        }
        
        .option-item.selected {
            border-color: var(--primary-color);
            background-color: var(--primary-light);
        }
        
        .option-marker {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: var(--spacing-md);
            font-size: 14px;
            color: var(--text-secondary);
            flex-shrink: 0;
        }
        
        .option-item.selected .option-marker {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
            color: white;
        }
        
        .option-content {
            font-size: 14px;
            color: var(--text-primary);
        }
        
        .question-actions {
            display: flex;
            justify-content: space-between;
            margin-top: var(--spacing-lg);
        }
        
        .question-nav-btn {
            display: flex;
            align-items: center;
            padding: var(--spacing-sm) var(--spacing-md);
            border-radius: var(--radius-md);
            font-size: 14px;
            font-weight: 500;
        }
        
        .btn-prev {
            color: var(--text-secondary);
            background-color: var(--bg-light);
        }
        
        .btn-prev i {
            margin-right: 4px;
        }
        
        .btn-next {
            color: white;
            background-color: var(--primary-color);
        }
        
        .btn-next i {
            margin-left: 4px;
        }
        
        .answer-card {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: var(--bg-white);
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
            transform: translateY(100%);
            transition: transform 0.3s ease;
        }
        
        .answer-card.active {
            transform: translateY(0);
        }
        
        .answer-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--spacing-md);
            border-bottom: 1px solid var(--border-color);
        }
        
        .answer-card-title {
            font-size: 16px;
            font-weight: 500;
            color: var(--text-primary);
        }
        
        .close-btn {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background-color: var(--bg-light);
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .answer-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: var(--spacing-sm);
            padding: var(--spacing-md);
            max-height: 200px;
            overflow-y: auto;
        }
        
        .answer-item {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            font-size: 14px;
        }
        
        .answer-item.answered {
            background-color: var(--success-color);
            color: white;
        }
        
        .answer-item.active {
            background-color: var(--primary-color);
            color: white;
        }
        
        .answer-card-footer {
            display: flex;
            justify-content: space-between;
            padding: var(--spacing-md);
            border-top: 1px solid var(--border-color);
        }
        
        .answer-status {
            font-size: 14px;
            color: var(--text-secondary);
        }
        
        .submit-btn {
            padding: var(--spacing-sm) var(--spacing-lg);
            border-radius: 20px;
            background-color: var(--primary-color);
            color: white;
            font-size: 14px;
            font-weight: 500;
        }
        
        .show-card-btn {
            position: fixed;
            bottom: var(--spacing-md);
            right: var(--spacing-md);
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background-color: var(--primary-color);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            z-index: 90;
        }
        
        @keyframes pulse {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }
    </style>
</head>
<body>
    <div class="app-container">
        <!-- 顶部状态栏 -->
        <header class="app-header">
            <div class="status-bar">
                <span class="time">14:25</span>
                <div class="status-icons">
                    <span class="icon-wifi"></span>
                    <span class="icon-signal"></span>
                    <span class="icon-battery">80%</span>
                </div>
            </div>
            <div class="header-content">
                <a href="course-detail.html" class="back-btn">
                    <i class="icon-back"></i>
                </a>
                <h1>课程考试</h1>
                <div class="header-actions">
                    <a href="#" class="icon-more"></a>
                </div>
            </div>
        </header>

        <!-- 考试信息 -->
        <div class="exam-header">
            <h2 class="exam-title">老年人心理健康关怀期末考试</h2>
            <div class="exam-info">
                <div class="exam-info-item">
                    <i class="icon-question"></i>
                    <span>共20题</span>
                </div>
                <div class="exam-info-item">
                    <i class="icon-time"></i>
                    <span>时长30分钟</span>
                </div>
                <div class="exam-info-item">
                    <i class="icon-score"></i>
                    <span>满分100分</span>
                </div>
                <div class="exam-info-item">
                    <i class="icon-pass"></i>
                    <span>及格分数60分</span>
                </div>
            </div>
            <div class="timer-container">
                <div class="timer-label">剩余时间</div>
                <div class="timer">28:45</div>
            </div>
        </div>

        <!-- 题目导航 -->
        <div class="question-nav">
            <div class="question-number active">1</div>
            <div class="question-number">2</div>
            <div class="question-number">3</div>
            <div class="question-number">4</div>
            <div class="question-number">5</div>
            <div class="question-number">6</div>
            <div class="question-number">7</div>
            <div class="question-number">8</div>
            <div class="question-number">9</div>
            <div class="question-number">10</div>
            <div class="question-number">11</div>
            <div class="question-number">12</div>
            <div class="question-number">13</div>
            <div class="question-number">14</div>
            <div class="question-number">15</div>
            <div class="question-number">16</div>
            <div class="question-number">17</div>
            <div class="question-number">18</div>
            <div class="question-number">19</div>
            <div class="question-number">20</div>
        </div>

        <!-- 题目内容 -->
        <div class="question-container">
            <div class="question-header">
                <div class="question-type">单选题</div>
                <div class="question-points">5分</div>
            </div>
            <div class="question-content">
                <p>1. 下列哪项不属于老年人常见的心理特点？</p>
            </div>
            <div class="options-list">
                <div class="option-item">
                    <div class="option-marker">A</div>
                    <div class="option-content">情绪波动较大，容易焦虑</div>
                </div>
                <div class="option-item">
                    <div class="option-marker">B</div>
                    <div class="option-content">对新事物接受能力较强</div>
                </div>
                <div class="option-item">
                    <div class="option-marker">C</div>
                    <div class="option-content">回忆过去的倾向增强</div>
                </div>
                <div class="option-item">
                    <div class="option-marker">D</div>
                    <div class="option-content">自我中心倾向增强</div>
                </div>
            </div>
            <div class="question-actions">
                <button class="question-nav-btn btn-prev">
                    <i class="icon-left"></i>
                    上一题
                </button>
                <button class="question-nav-btn btn-next">
                    下一题
                    <i class="icon-right"></i>
                </button>
            </div>
        </div>

        <!-- 答题卡按钮 -->
        <div class="show-card-btn">
            <i class="icon-list"></i>
        </div>

        <!-- 答题卡 -->
        <div class="answer-card">
            <div class="answer-card-header">
                <div class="answer-card-title">答题卡</div>
                <div class="close-btn">
                    <i class="icon-close"></i>
                </div>
            </div>
            <div class="answer-grid">
                <div class="answer-item active">1</div>
                <div class="answer-item">2</div>
                <div class="answer-item">3</div>
                <div class="answer-item">4</div>
                <div class="answer-item">5</div>
                <div class="answer-item">6</div>
                <div class="answer-item">7</div>
                <div class="answer-item">8</div>
                <div class="answer-item">9</div>
                <div class="answer-item">10</div>
                <div class="answer-item">11</div>
                <div class="answer-item">12</div>
                <div class="answer-item">13</div>
                <div class="answer-item">14</div>
                <div class="answer-item">15</div>
                <div class="answer-item">16</div>
                <div class="answer-item">17</div>
                <div class="answer-item">18</div>
                <div class="answer-item">19</div>
                <div class="answer-item">20</div>
            </div>
            <div class="answer-card-footer">
                <div class="answer-status">已答 0/20 题</div>
                <button class="submit-btn">交卷</button>
            </div>
        </div>
    </div>

    <script src="js/common.js"></script>
    <script>
        // 选项选择
        document.querySelectorAll('.option-item').forEach(option => {
            option.addEventListener('click', function() {
                // 清除其他选项的选中状态
                document.querySelectorAll('.option-item').forEach(item => {
                    item.classList.remove('selected');
                });
                
                // 设置当前选项为选中状态
                this.classList.add('selected');
                
                // 更新答题卡状态
                document.querySelector('.question-number.active').classList.add('answered');
                document.querySelector('.answer-item.active').classList.add('answered');
                
                // 更新已答题数
                updateAnsweredCount();
            });
        });
        
        // 题目导航
        document.querySelectorAll('.question-number').forEach((numBtn, index) => {
            numBtn.addEventListener('click', function() {
                // 清除当前选中状态
                document.querySelector('.question-number.active').classList.remove('active');
                document.querySelector('.answer-item.active').classList.remove('active');
                
                // 设置新的选中状态
                this.classList.add('active');
                document.querySelectorAll('.answer-item')[index].classList.add('active');
                
                // 这里应该加载对应题目的内容
                // loadQuestion(index + 1);
            });
        });
        
        // 答题卡显示/隐藏
        const showCardBtn = document.querySelector('.show-card-btn');
        const answerCard = document.querySelector('.answer-card');
        const closeBtn = document.querySelector('.close-btn');
        
        showCardBtn.addEventListener('click', function() {
            answerCard.classList.add('active');
        });
        
        closeBtn.addEventListener('click', function() {
            answerCard.classList.remove('active');
        });
        
        // 更新已答题数
        function updateAnsweredCount() {
            const answeredCount = document.querySelectorAll('.question-number.answered').length;
            document.querySelector('.answer-status').textContent = `已答 ${answeredCount}/20 题`;
        }
        
        // 倒计时
        function startTimer(duration) {
            let timer = duration;
            const timerDisplay = document.querySelector('.timer');
            
            const interval = setInterval(function() {
                const minutes = parseInt(timer / 60, 10);
                const seconds = parseInt(timer % 60, 10);
                
                timerDisplay.textContent = minutes.toString().padStart(2, '0') + ':' + 
                                          seconds.toString().padStart(2, '0');
                
                // 时间少于5分钟显示警告
                if (timer < 300) {
                    timerDisplay.classList.add('warning');
                }
                
                // 时间少于1分钟显示危险
                if (timer < 60) {
                    timerDisplay.classList.remove('warning');
                    timerDisplay.classList.add('danger');
                }
                
                if (--timer < 0) {
                    clearInterval(interval);
                    timerDisplay.textContent = '00:00';
                    // 时间到自动交卷
                    alert('考试时间已到，系统将自动交卷');
                    // submitExam();
                }
            }, 1000);
        }
        
        // 初始化倒计时30分钟
        startTimer(30 * 60);
    </script>
</body>
</html> 